#ifndef _vector_traits_spec_hpp_
#define _vector_traits_spec_hpp_

/* \file vector_traits_spec.hpp Contains specializations of the field 
 *  and dimension metafunctions
 */

namespace core {

    namespace math {

        namespace detail {

            template<class T, std::size_t N>
                struct static_dimension_impl : public size_t<N>
                {
                    static std::size_t get(const T& t)
                    {
                        return N;
                    }
                };

            template<class T>
                struct stl_dynamic_dimension_impl : public size_t<0>
                {
                    static std::size_t get(const T& t)
                    {
                        return t.size();
                    }
                };

        } // namespace detail

        template<class T, std::size_t N>
            struct dimension<boost::array<T,N> >
            : public detail::static_dimension_impl<boost::array<T,N>,N>
            { };

        template<class T, std::size_t N>
            struct dimension<T[N] >
            : public detail::static_dimension_impl<T[N],N>
            { };

        template<class T, class A>
            struct dimension<std::vector<T,A> >
            : public detail::stl_dynamic_dimension_impl<std::vector<T,A> >
            { };

        template<class T>
            struct dimension<std::valarray<T> >
            : public detail::stl_dynamic_dimension_impl<std::valarray<T> >
            { };

        //specialization for Point, Index, std::vector, std::valarray, boost::array and builtin static arrays
        template<class T, std::size_t N>
            struct field<boost::array<T,N> >
            {
                typedef T   type;
            };

        template<class T, std::size_t N>
            struct field<T[N] >
            {
                typedef T   type;
            };

        template<class T, class A>
            struct field<std::vector<T,A> >
            {
                typedef T   type;
            };

        template<class T>
            struct field<std::valarray<T> >
            {
                typedef T   type;
            };

        //TODO:queries to determine the behaviour of the different operator implementations of the vectors

    } // namespace math

} // namespace core

#endif // _vector_traits_spec_hpp_
